from flask import Flask
import api.config as api
import models.loginDao as Ld
import models.userDao as User
import models.roleDao as Role
import models.projectDao as Project

app = Flask(__name__)

# app.config.from_object('config')
# app.config.from_envvar('FLASK_SETTINGS', silent=True)


# 登录页面
@app.route(api.login, methods=['GET', 'POST'])
def login():
    return Ld.login()


# 用户列表页面
@app.route('/users_view', methods=['GET', 'POST'])
def users_view():
    return User.users_view()


@app.route('/users_add', methods=['GET', 'POST'])
def users_add():
    return User.users_add()


@app.route('/users_drop', methods=['GET', 'POST'])
def users_drop():
    return User.users_drop()


@app.route('/users_edit_open', methods=['GET', 'POST'])
def users_edit_open():
    return User.users_edit_open()


@app.route('/users_edit', methods=['GET', 'POST'])
def users_edit():
    return User.users_edit()


@app.route('/users_give_open', methods=['GET', 'POST'])
def users_give_open():
    return User.users_give_open()


@app.route('/role_view', methods=['GET', 'POST'])
def role_view():
    return Role.role_view()


@app.route('/users_editrole', methods=['GET', 'POST'])
def users_editrole():
    return User.users_editrole()


# 角色列表页面
@app.route('/role_add', methods=['GET', 'POST'])
def role_add():
    return Role.role_add()


@app.route('/role_edit_open', methods=['GET', 'POST'])
def role_edit_open():
    return Role.role_edit_open()


@app.route('/role_edit', methods=['GET', 'POST'])
def role_edit():
    return Role.role_edit()


@app.route('/role_drop', methods=['GET', 'POST'])
def role_drop():
    return Role.role_drop()


# 项目列表
@app.route('/item_view', methods=['GET', 'POST'])
def item_view():
    return Project.item_view()


@app.route('/item_add', methods=['GET', 'POST'])
def item_add():
    return Project.item_add()


@app.route('/item_edit_open', methods=['GET', 'POST'])
def item_edit_open():
    return Project.item_edit_open()


@app.route('/item_edit', methods=['GET', 'POST'])
def item_edit():
    return Project.item_edit()

















if __name__ == '__main__':
    app.run()